package com.aorise.model.request;

import com.aorise.service.system.RoleService;
import com.aorise.service.system.UserService;
import com.aorise.utils.DataValidationUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;

/**
 * @Auther: zhouhao
 * @Date: 2019/5/16
 * @Description:
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class RegisterUserReq implements Serializable{

    @ApiModelProperty(value = "账号",example = "test" )
    @Length(min = 6,max = 16,groups = UserService.class,message = "账号不能为空且长度需要在6和16之间")
    private String account;

    @ApiModelProperty(value = "姓名",example = "test" )
    @Length(min = 2,max = 20,message = "姓名不能为空且长度需要在2和20之间",groups = {UserService.class, RoleService.class})
    private String username;

    @ApiModelProperty(value = "用户类型",example = "1" )
    private Integer userType;

    @ApiModelProperty(value = "角色ID",example = "1" )
    @NotNull(message = "角色不能为空",groups = {UserService.class, RoleService.class})
    private Integer roleId;

    @ApiModelProperty(value = "组织架构ID",example = "1" )
    @NotNull(message = "组织架构不能为空",groups = {UserService.class, RoleService.class})
    private Integer orgId;

    @ApiModelProperty(value = "职务",example = "007" )
    @Length(max = 20,message = "职务不能为空且长度不能超过20位",groups = {UserService.class, RoleService.class})
    private String deptId;

    @ApiModelProperty(value = "手机号码")
    @Pattern(regexp = DataValidationUtil.V_MOBILENULL,message ="手机号码必须为数字")
    @Length(max = 11,message = "手机号码限制11位数",groups = {UserService.class, RoleService.class})
    private String phone;

    @ApiModelProperty(value = "token")
    private String token;
}
